About RBG LEDs
They have 3 leds inside of them, Red Green and Blue. It allows this combined LED to output colors of many hues via adjusting the voltage for each individual led.
the above image will help in preventing you from breaking the component by accident. for the common cathode, you connect the 2nd pin from left to ground. for the commmon anode, connect the same pin to vcc.
by mixing the values for each internal light ( red, green, blue ), you can get multiple colours.
The ldr in this video (on the breadboard) takes in the ambient light and measures accordingly. The more light there is, the higher the value measured. By using this, I write a random mathematical equation in order to let each led in the rgb led give a different intensity, thereby giving a variety of colors. Of course, the values must be between 0 to 1023, so the program also checks for it before putting it as an output for the rgb led.
as you can see, my rgb led only has 3 different colors here, as i have set it to only these three colors. I tried varying the colors a bit, but there is only red, blue, cyan, green available.
Here's the original code (with download link at image below!)